// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) KALEIDOS INC

@use "ds/typography.scss" as t;
@use "ds/spacing.scss";
@use "ds/_borders.scss" as *;
@use "ds/_sizes.scss" as *;
@use "ds/_utils.scss" as *;
@use "refactor/basic-rules.scss" as *;

.colorpicker-tooltip {
  @extend .modal-background;
  left: calc(10 * px2rem(140));
  width: auto;
  padding: var(--sp-m);
  width: $sz-284;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.colorpicker {
  border-radius: $br-8;
  overflow: hidden;
}

.top-actions {
  display: flex;
  align-items: flex-start;
  flex-direction: row-reverse;
  justify-content: space-between;
  height: $sz-40;
}

.top-actions-right {
  display: flex;
  gap: var(--sp-s);
}

.opacity-input-wrapper {
  @extend .input-element;
  @include t.use-typography("body-small");
  width: px2rem(68);
}

// TODO: change to DS button component
.picker-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: $br-8;
  background-color: transparent;
  border: $b-1 solid transparent;
  height: var(--sp-xl);
  width: var(--sp-xl);
  border-radius: $br-4;
  padding: 0;
  margin-top: var(--sp-xs);
  svg {
    @extend .button-icon;
    stroke: var(--button-tertiary-foreground-color-rest);
  }
  &:hover {
    svg {
      stroke: var(--button-tertiary-foreground-color-focus);
    }
  }
  &:focus,
  &:focus-visible {
    outline: none;
    svg {
      stroke: var(--button-secondary-foreground-color-hover);
    }
  }
  &:active {
    outline: none;
    border: $b-1 solid transparent;
    svg {
      stroke: var(--button-tertiary-foreground-color-active);
    }
  }
  &.selected {
    svg {
      stroke: var(--button-tertiary-foreground-color-active);
    }
  }
}

.gradient-buttons {
  display: flex;
  align-items: center;
  gap: var(--sp-s);
}

.gradient-btn {
  @extend .button-tertiary;
  height: var(--sp-xl);
  width: var(--sp-xl);
  border-radius: $br-4;
  border: $b-2 solid transparent;
  &:hover {
    border: $b-2 solid var(--colorpicker-details-color-selected);
  }
}

.linear-gradient-btn {
  background: linear-gradient(180deg, var(--color-foreground-secondary), transparent);
  &.selected {
    background: linear-gradient(to bottom, rgba(126, 255, 245, 1) 0%, rgba(126, 255, 245, 0.2) 100%);
    border: $b-2 solid var(--colorpicker-details-color-selected);
  }
}

.radial-gradient-btn {
  background: radial-gradient(transparent, var(--color-foreground-secondary));
  &.selected {
    background: radial-gradient(rgba(126, 255, 245, 1) 0%, rgba(126, 255, 245, 0.2) 100%);
    border: $b-2 solid var(--colorpicker-details-color-selected);
  }
}

.actions {
  display: flex;
  gap: var(--sp-xs);
}

.accept-color {
  @include t.use-typography("headline-small");
  @extend .button-primary;
  width: 100%;
  height: var(--sp-xxxl);
  margin-top: var(--sp-s);
}

.picker-detail-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin: var(--sp-m) 0 var(--sp-s) 0;
}

.center-circle {
  width: var(--sp-xxl);
  height: var(--sp-xxl);
  border: $b-2 solid var(--colorpicker-details-color);
  border-radius: $br-circle;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(calc(-1 * var(--sp-m)), calc(-1 * var(--sp-m)));
}

.picker-detail {
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.select {
  width: px2rem(116);
}

.select-image {
  margin-top: var(--sp-xs);
}

.content {
  border-radius: $br-8;
  display: flex;
  justify-content: center;
  background-image: url("/images/colorpicker-no-image.png");
  background-position: center;
  background-size: auto px2rem(140);
  height: px2rem(140);
  margin-bottom: $sz-6;
  margin-right: $sz-1;
  img {
    height: fit-content;
    width: fit-content;
    max-height: 100%;
    max-width: 100%;
    margin: auto;
  }
}

.choose-image {
  @extend .button-secondary;
  @include t.use-typography("headline-small");
  width: 100%;
  margin-top: var(--sp-m);
  height: var(--sp-xxxl);
}

.checkbox-option {
  @extend .input-checkbox;
  margin: var(--sp-l) 0 0 0;
}

.token-color-title {
  @include t.use-typography("title-small");
  color: var(--color-foreground-secondary);
  display: flex;
  align-items: center;
  height: var(--sp-xxxl);
}
